import os
import datetime
import liweibo
from wxauto import WeChat

today = datetime.date.today()
yesterday = today - datetime.timedelta(days=1)

os.chdir(r'D:\lz\每日空调\liweibo')

if len(os.listdir()) == 3:
    print('数据已存在，跳过下载')
else:
    liweibo.main()
try:
    wx = WeChat()
    # 发送空调数据
    files = [f'D:\lz\每日空调\liweibo\{i}' for i in os.listdir()]
    who = '空调驻场李伟波'
    wx.SendFiles(files, who=who)
    # 发送消息给李伟波
    for file in files:
        os.remove(file)
except Exception as e:
    print('发送微信失败', e)
